<?php

namespace app\model;

use think\model\concern\SoftDelete;

class Data extends BaseModel
{
    public function getTemperatureAttr($value)
    {
        if (6500 < $value) {
            $temperature = $value - 6553.5;
        } else {
            $temperature = $value;
        }
        $temperature += 2.9;

        return number_format($temperature, 2);
    }

    public function getSerialNumberAttr($value)
    {
        //贵阳至黄平桥头01
        //贵阳至黄平桥中02
        //黄平至贵阳桥头03
        //黄平至贵阳桥中04
        switch ($value) {
            case 'JL20250124001':
                $title = '贵阳至黄平桥头01';
                break;
            case 'JL20250124002':
                $title = '贵阳至黄平桥中02';
                break;
            case 'JL20250124003':
                $title = '黄平至贵阳桥头03';
                break;
            case 'JL20250124004':
                $title = '黄平至贵阳桥中04';
                break;
            default:
                $title = $value;
        }

        return $title;
    }

    public function getWaterFilmAttr($value)
    {
        return number_format($value / 100, 2);
    }
}